

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>灾难恢复 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="cephfs-journal-tool" href="../cephfs-journal-tool/" />
    <link rel="prev" title="故障排除" href="../troubleshooting/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 文件系统</a></li>
      <li class="breadcrumb-item active">灾难恢复</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/cephfs/disaster-recovery.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id4">管理</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../eviction/"> 驱逐客户端</a></li>
<li class="toctree-l3"><a class="reference internal" href="../scrub/"> 洗刷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../full/"> 文件系统占满的处理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../disaster-recovery-experts/"> 元数据修复</a></li>
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/"> 故障排除</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> 灾难恢复</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id2">元数据损坏及其修复</a></li>
<li class="toctree-l4"><a class="reference internal" href="#pg">数据存储池损坏（受数据 PG 丢失影响的文件）</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-journal-tool/"> cephfs-journal-tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../recover-fs-after-mon-store-loss/"> 监视器存储丢失后恢复文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#id8">开发者指南</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="cephfs-disaster-recovery">
<span id="id1"></span><h1>灾难恢复<a class="headerlink" href="#cephfs-disaster-recovery" title="Permalink to this heading"></a></h1>
<section id="id2">
<h2>元数据损坏及其修复<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>如果一个文件系统出现了不一致或者丢失的元数据，就视为 <em>损坏了</em> 。
你可以从健康消息、或者更倒霉的话，从正常运行的 MDS 守护进程的断言了解到损坏情况。</p>
<p>元数据损坏的起因是底层 RADOS 层面的数据丢失（比如，
多个磁盘失效，导致某个 PG 的所有副本丢失），或者软件缺陷。</p>
<p>CephFS 有一些工具可以用于恢复损坏的文件系统，但是，要安全地使用它们，
需要对 CephFS 内部机制有透彻的理解。这些有潜在危险的操作，
有一份单独的文档： <a class="reference internal" href="../disaster-recovery-experts/#disaster-recovery-experts"><span class="std std-ref">高级话题：元数据修复工具</span></a> 。</p>
</section>
<section id="pg">
<h2>数据存储池损坏（受数据 PG 丢失影响的文件）<a class="headerlink" href="#pg" title="Permalink to this heading"></a></h2>
<p>如果是 <em>数据（ data ）</em> 存储池中的一个 PG 丢失了，
这个文件系统还可以正常运作，只是一部分文件的一部分数据块丢失了
（读取操作会得到 0 ）。</p>
<p>丢失一个数据 PG 会影响很多文件。文件被拆分成了很多对象，所以要找出哪些文件受这些 PG 丢失的影响，需要扫描所有的对象 ID 以确认文件的副本数合格。这种扫描有助于找出哪些文件需要从备份恢复。</p>
<div class="admonition danger">
<p class="admonition-title">Danger</p>
<p>这个命令不会修复任何元数据，所以在恢复文件时，你必须<em>删除</em>损坏的文件，然后再替换它，这样才会获得完好的 inode 。不要原地替换损坏的文件。</p>
</div>
<p>如果你已经知道了哪些 PG 丢失了对象，可以用 <code class="docutils literal notranslate"><span class="pre">pg_files</span></code> 子命令扫描可能损坏的文件，命令为：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cephfs</span><span class="o">-</span><span class="n">data</span><span class="o">-</span><span class="n">scan</span> <span class="n">pg_files</span> <span class="o">&lt;</span><span class="n">path</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">pg</span> <span class="nb">id</span><span class="o">&gt;</span> <span class="p">[</span><span class="o">&lt;</span><span class="n">pg</span> <span class="nb">id</span><span class="o">&gt;...</span><span class="p">]</span>
</pre></div>
</div>
<p>例如，假设你已经知道 PG 1.4 和 4.5 有数据丢失，然后你想知道
/home/bob 下面的哪些文件可能损坏了：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cephfs</span><span class="o">-</span><span class="n">data</span><span class="o">-</span><span class="n">scan</span> <span class="n">pg_files</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">bob</span> <span class="mf">1.4</span> <span class="mf">4.5</span>
</pre></div>
</div>
<p>输出是可能损坏的文件路径列表，每行一个。</p>
<p>请注意，此命令是作为一个普通的 CephFS 客户端来搜寻文件系统内的所有文件、并读取它们的布局的，
所以 MDS 必须是正常运行的。</p>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../troubleshooting/" class="btn btn-neutral float-left" title="故障排除" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../cephfs-journal-tool/" class="btn btn-neutral float-right" title="cephfs-journal-tool" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>